package com.list88zhu.common.rxhttp.http.exception;

/**
 * projectName rxretrofit
 * date 2017/7/7
 * description com.example.administrator.rxjavaretrofitsample.exception
 */

public class ApiException extends Exception {

    //错误码
    private int code;
    //错误信息
    private String message;

    public ApiException(Throwable e){
        super(e);
    }

    public ApiException(Throwable throwable, @CodeException.Code int code, String message){
        super(message, throwable);
        setCode(code);
        setMessage(message);
    }

    @CodeException.Code
    public int getCode() {
        return code;
    }

    public void setCode(@CodeException.Code int code) {
        this.code = code;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    @Override
    public String getMessage() {
        return message;
    }
}
